import os, re, sys
from subprocess import call

#""" User Config


#"""

"""
plugin_proper_name
plugin_folder_name
plugin_var_name
plugin_const_name
"""

try:
	plugin_proper_name = sys.argv[1]
except IndexError:
	print("Plugin name required. Example: wpp-create.py \"Plugin Name\"")
	exit()

p = re.compile('\s')
plugin_folder_name = p.sub('-', plugin_proper_name.lower())
plugin_var_name    = p.sub('_', plugin_proper_name.lower())
plugin_const_name  = p.sub('_', plugin_proper_name.upper())

mkdir_list = [
	plugin_folder_name,
	plugin_folder_name + "/cache",
	plugin_folder_name + "/css",
	plugin_folder_name + "/images",
	plugin_folder_name + "/js",
	plugin_folder_name + "/lang",
	plugin_folder_name + "/template"
	]

for dir in mkdir_list:
	try:
		os.mkdir(dir)
	except:
		pass

call("kafe-create.pl {PLUGIN_FOLDER_NAME}".format(PLUGIN_FOLDER_NAME=plugin_folder_name), shell=True)



"""

os.mkdir(plugin_folder_name+"/cache")
`mkdir $plugin_name/css`;
`mkdir $plugin_name/images`;
`mkdir $plugin_name/js`;
`mkdir $plugin_name/lang`;
`mkdir $plugin_name/template`;
`touch $plugin_name/css/main.css`;
`touch $plugin_name/$plugin_name-admin.php`;
`kafe-create.pl $plugin_name`
"""